Ext.define('appmod.view.user.UserRoleSelectedForm', {
    extend: 'Ext.form.Panel',
    alias: ['widget.user.roleselectedform','widget.user-roleselectedform'],
	requires:[
		'Ext.ux.form.ItemSelector'
	],
    bodyPadding: 10,
	
	constructor: function (config) {
		
		if (config.fieldStores) {
			this.fieldStores = config.fieldStores;
		}
        this.callParent(arguments);
     },	
	
    initComponent: function() {
      	var me = this;
	  
	  	var fieldStores = me.fieldStores;
		var dsRoleIds = null;
		try {
			dsRoleIds = fieldStores['dsRoleIds'];
		} catch (e) {
			Ext.log({
				msg : '[appmod.view.user.UserRoleSelectedForm]' + e,
				level:'error'
			});
		}		  

	  

      Ext.applyIf(me, {
            items: [
                {
                    xtype: 'displayfield',
                    name: 'name',
                    fieldLabel: '登陆帐号名'
                },
                {
                    xtype: 'hiddenfield',
                    name: 'id',
                    fieldLabel: 'id'
                },
				{
					height: 330,
		            xtype: 'itemselector',
		            name: 'selectedRoles',
		            anchor: '100%',
		            fieldLabel: '指定角色',
		            imagePath: '../../js/ux/images/',
		            store:dsRoleIds,
		            displayField: 'name',
		            valueField: 'id',
		            msgTarget: 'side',
				    buttonsText: {
				        top: "移到最顶",
				        up: "向上移",
				        add: "选择",
				        remove: "移除",
				        down: "向下移",
				        bottom: "移到最底"
				    }					
		        }								
            ]
        });

        me.callParent(arguments);
    }

});